/* 
 * File:   IttenTable.cpp
 * Author: claudio
 * 
 * Created on March 14, 2013, 5:47 PM
 */

#include "IttenTable.h"

IttenTable::IttenTable() {
//    table = new HashMap<EnumColor, Integer>();
    pair<EnumColor,int> yellow(YELLOW,3);
    pair<EnumColor,int> orange(ORANGE,4);
    pair<EnumColor,int> red(RED,6);
    pair<EnumColor,int> violet(VIOLET,9);
    pair<EnumColor,int> blue(BLUE,8);
    pair<EnumColor,int> green(GREEN,6);
//		table.put(EnumColor.YELLOW, 3);
//		table.put(EnumColor.ORANGE, 4);
//		table.put(EnumColor.RED, 6);
//		table.put(EnumColor.VIOLET, 9);
//		table.put(EnumColor.BLUE, 8);
//		table.put(EnumColor.GREEN, 6);
    table.push_back(yellow);
    table.push_back(orange);
    table.push_back(red);
    table.push_back(violet);
    table.push_back(blue);
    table.push_back(green);

}

IttenTable::~IttenTable() {
}

double IttenTable::verifyHarmony(Image i){
    double harmonyError = 0;
    for(int a=0; a< table.size(); a++){
        for(int b=0;b<table.size();b++){
            double val1 = i.getSectorSize(table[a].first)*table[a].second;
            double val2 = i.getSectorSize(table[b].first)*table[b].second;
            double inc = abs(  val1-val2 );
            harmonyError+= inc;
            
        }
    }
    return harmonyError;
}

